package com.eascs.web.o2o.web.aging.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.eascs.app.dao.JdbcSession;
import com.eascs.web.o2o.web.aging.service.DicDataDao;
import com.eascs.web.o2o.web.dao.BiodsDao;
import com.eascs.workflow.common.entity.wf.DicData;

@Repository
public class DicDataDaoImpl extends BiodsDao implements DicDataDao {

	private static final String DICTIONARY_DATA_TABLE = "ods_o2oworkflow_wf_dictionary_data";
	private static final String DICTIONARY_TYPE_TABLE = "ods_o2oworkflow_wf_dictionary_type";
	
	@Autowired
	JdbcSession jdbcSessionBiods;
	@Override
	public List<DicData> getDicDataByType(String dataType) {
		String sql = "select d.`code`,d.`name` from "+DICTIONARY_DATA_TABLE+" d ,"+DICTIONARY_TYPE_TABLE+" t where t.id = d.type and t.type= ?";
		return jdbcSessionBiods.findEntitys(sql, DicData.class, dataType);
	}

	/*@Override
	public List<DicData> getDicDataByTypeAndKeys(String dataType, List<String> keys) {
		String sql = "select d.`code`,d.`name` from wf_dictionary_data d ,wf_dictionary_type t where t.id = d.type and t.type= ?";
		StringBuffer keyBuf = new StringBuffer();
		for (String key : keys) {
			keyBuf.append("'").append(key).append("',");
		}
		if (keyBuf.length() > 0) {
			sql = sql + " and d.code in (" + keyBuf.substring(0, keyBuf.length() - 1) + ")";
		}
		return workflowJdbcSession.findEntitys(sql, DicData.class, dataType);
	}*/

}
